home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / actlib13.zip / STRINGS.ZIP / MVCHR.C < prev    next >
Text File  |  1993-01-14  |  698b  |  29 lines

  1. /*  Copyright (C) 1993   Marc Stern  (internet: stern@mble.philips.be)  */
  2.  
  3. #include "strings.h"
  4.  
  5. /***
  6.  *  Function    :  strmvchr
  7.  *
  8.  *  Description :  Replace all occurences of a target character
  9.  *           by a new character.
  10.  *
  11.  *  Parameters  :  in/out   char  *string
  12.  *                 in       char  target     target char to replace
  13.  *                 in       char  new_char   char to put in place of target
  14.  *
  15.  *  Return code :  pointer to result.
  16.  *
  17.  *  OS/Compiler :  All
  18.  ***/
  19.     
  20. char *strmvchr( char *string, char target, char new_char )
  21.  
  22. { char *ptr;
  23.  
  24.   for ( ptr = string; *ptr ; ptr ++ )
  25.       if ( *ptr == target ) *ptr = new_char;
  26.  
  27.   return string;
  28. }
  29.